
#include <Inklude/ikCUdpServer.h>

using namespace Inklude;

ikCUdpServer::ikCUdpServer()
{
    _init();
}

ikCUdpServer::~ikCUdpServer()
{
}


void ikCUdpServer::_init()
{
    m_pUdpClient.reset(new ikCUdpClient);
}


void ikCUdpServer::OpenServer(int nPort)
{
    m_nPort = nPort;
    m_pUdpClient->Initialize(m_nPort);
}

ikCUdpClientPtr ikCUdpServer::CheckForNewConnection(INKLUDE_UDP Mode)
{
    if (m_pUdpClient->Receive(NULL, 0) == 0)
    {
        return m_pUdpClient;
        /*ikCUdpClientPtr _ptr = m_pUdpClient;
        m_pUdpClient.reset(new ikCUdpClient);
        m_pUdpClient->Initialize(m_nPort);
        return _ptr;*/
    }
    return NULL;
}

